import type { RouteRecordRaw } from "vue-router";

// @ts-ignore
export interface AppRouteRecordRaw extends RouteRecordRaw {
  path: string;
  name?: string;
  component?: any;
  hidden?: boolean;
  redirect?: string;
  children?: AppRouteRecordRaw[];
  meta?: RouteMeta;
}

interface RouteMeta {
  title: string;
  menu_type?: string;
  is_frame?: string;
  cache?: boolean; // 是否缓存
  icon?: string;
}

const constantRoutes: AppRouteRecordRaw[] = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("@/views/login/index.vue"),
  },
  {
    path: "/redirect",
    component: () => import("@/layout/index.vue"),
    name: "Redirect",
    children: [
      {
        path: "/redirect/:path(.*)",
        name: "Redirect",
        component: () => import("@/views/redirect/index.vue"),
      },
    ],
  },
  // {
  //   path: "/userInfo",
  //   component: () => import("@/layout/index.vue"),
  //   children: [
  //     {
  //       path: "profile",
  //       name: "Profile",
  //       component: () => import("@/views/system/user/profile/index.vue"),
  //       meta: {
  //         title: "用户中心",
  //       },
  //     },
  //   ],
  // },
  {
    path: "/401",
    name: "401",
    component: () => import("@/views/error/401.vue"),
  },
  {
    path: "/404",
    name: "404",
    component: () => import("@/views/error/404.vue"),
  },
];

export default constantRoutes;
